//
//  BBMyApplyDetailViewCell.m
//  2222
//
//  Created by BearBaby on 16/3/25.
//  Copyright © 2016年 BearBaby. All rights reserved.
//

#import "BBMyApplyDetailViewCell.h"
#import "BBSixHeader.h"
@implementation BBMyApplyDetailViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.images = @[@"1.png",@"2.png",@"2.png"];
        //头像
        self.headImage = [[UIImageView alloc]initWithFrame:CGRectMake(15, 15, 50, 50)];
        self.headImage.image = [UIImage imageNamed:@"2.png"];
        self.headImage.layer.cornerRadius = 25;
        self.headImage.layer.masksToBounds = YES;
        [self addSubview:self.headImage];
        //名字
        self.nameLabel = [[UILabel alloc]init];
        self.nameLabel.text = @"Mark";
        self.nameLabel.textColor = [UIColor colorWithRed:228/255.0 green:104/255.0 blue:111/255.0 alpha:1];
        self.nameLabel.font = [UIFont systemFontOfSize:WINSIZEWIDTH/25];
        CGSize nameSize = [self.nameLabel.text sizeWithFont:self.nameLabel.font constrainedToSize:CGSizeMake(300, 300) lineBreakMode:NSLineBreakByCharWrapping];
        self.nameLabel.frame = CGRectMake(CGRectGetMaxX(self.headImage.frame)+10, 20, nameSize.width, nameSize.height);
        [self addSubview:self.nameLabel];
        //请假申请流程
        self.label = [[UILabel alloc]init];
        self.label.text = @"请假申请流程";
        self.label.font = [UIFont systemFontOfSize:WINSIZEWIDTH/25];
        CGSize labelSize = [self.label.text sizeWithFont:self.label.font constrainedToSize:CGSizeMake(300, 300) lineBreakMode:NSLineBreakByCharWrapping];
        self.label.frame = CGRectMake(WINSIZEWIDTH - 15 - labelSize.width, 20, labelSize.width, labelSize.height);
        [self addSubview:self.label];
        //时间
        self.dateLabel = [[UILabel alloc]init];
        self.dateLabel.text = @"2015-12-20 10:00";
        self.dateLabel.font = [UIFont systemFontOfSize:WINSIZEWIDTH/27];
        self.dateLabel.textColor = [UIColor colorWithRed:163/255.0 green:163/255.0 blue:163/255.0 alpha:1];
        CGSize dateSize = [self.dateLabel.text sizeWithFont:self.dateLabel.font constrainedToSize:CGSizeMake(300, 300) lineBreakMode:NSLineBreakByCharWrapping];
        self.dateLabel.frame = CGRectMake(self.nameLabel.frame.origin.x, CGRectGetMaxY(self.headImage.frame)-5-dateSize.height, dateSize.width, dateSize.height);
        [self addSubview:self.dateLabel];
        //流程
        self.liuchengLabel = [[UILabel alloc]init];
        self.liuchengLabel.text = @"请假时间：3天(12月11日--12月13日)";
        self.liuchengLabel.font = [UIFont systemFontOfSize:WINSIZEWIDTH/22];
        self.liuchengLabel.textColor = [UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1];
        CGSize liuchengSize = [self.liuchengLabel.text sizeWithFont:self.liuchengLabel.font constrainedToSize:CGSizeMake(300, 300) lineBreakMode:NSLineBreakByCharWrapping];
        self.liuchengLabel.frame = CGRectMake(15, CGRectGetMaxY(self.headImage.frame)+10, liuchengSize.width, liuchengSize.height);
        [self addSubview:self.liuchengLabel];
        //理由
        self.reasonLabel = [[UILabel alloc]init];
        self.reasonLabel.text = @"请假理由：加班";
        self.reasonLabel.font = [UIFont systemFontOfSize:WINSIZEWIDTH/22];
        self.reasonLabel.textColor = [UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1];
        CGSize reasonSize = [self.reasonLabel.text sizeWithFont:self.reasonLabel.font constrainedToSize:CGSizeMake(300, 300) lineBreakMode:NSLineBreakByCharWrapping];
        self.reasonLabel.frame = CGRectMake(self.liuchengLabel.frame.origin.x, CGRectGetMaxY(self.liuchengLabel.frame)+5, reasonSize.width, reasonSize.height);
        [self addSubview:self.reasonLabel];
        
        for (int i = 0; i<self.images.count; i++) {
                  
            self.imageV = [[UIImageView alloc]init];
            self.imageV.image = [UIImage imageNamed:[NSString stringWithFormat:@"%@",self.images[i]]];
           self.imageV.frame = CGRectMake(15+(WINSIZEWIDTH/4+10)*i, CGRectGetMaxY(self.reasonLabel.frame)+10, WINSIZEWIDTH/4, WINSIZEWIDTH/4);
            [self addSubview:self.imageV];
            
        }
        
        
        
        //状态
        self.typeLabel = [[UILabel alloc]init];
        self.typeLabel.text = @"状态：宗文君经理正在审批。。。";
        self.typeLabel.font = [UIFont systemFontOfSize:WINSIZEWIDTH/22];
        self.typeLabel.textColor = [UIColor colorWithRed:228/255.0 green:104/255.0 blue:111/255.0 alpha:1];
        CGSize typeSize = [self.typeLabel.text sizeWithFont:self.typeLabel.font constrainedToSize:CGSizeMake(300, 300) lineBreakMode:NSLineBreakByCharWrapping];
        self.typeLabel.frame = CGRectMake(self.reasonLabel.frame.origin.x, CGRectGetMaxY(self.imageV.frame)+10, typeSize.width, typeSize.height);
        [self addSubview:self.typeLabel];
        
        _finalH = CGRectGetMaxY(self.typeLabel.frame) + 10;
    }
    return self;
}

@end
